Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Oct 27, 2025

Fixes #8433

Summary

Instead of blocking the checkpoints feature when nested git repositories are detected, this PR modifies the behavior to exclude nested repos from staging, allowing checkpoints to work in monorepos and projects with submodules.

Changes

  • Removed initialization-time check: No longer throws an error when nested git repos are detected during
  • Added method: Detects nested repositories from multiple sources:
    • (declared submodules)
    • Git index (gitlinks with mode 160000)
    • Filesystem ( directories and worktrees)
  • Modified method: Uses pathspec excludes to prevent staging files from nested repos
  • Added safety check: Verifies no submodule changes are staged after the add operation
  • Updated tests: Modified test expectations to verify nested repos are properly excluded from checkpoints

Benefits

  • Checkpoints now work in monorepos and projects with submodules
  • Prevents git errors related to nested repository changes
  • Maintains checkpoint functionality for the main workspace files
  • Provides clear logging when nested repos are detected and excluded

Testing

All existing tests pass, including the updated test that now verifies:

  • Initialization succeeds with nested repos present
  • Only main workspace files are included in checkpoints
  • Nested repo changes are properly excluded
  • Logging confirms exclusion behavior

Important

Modifies checkpoints to exclude nested git repos from staging, allowing functionality in monorepos and submodules.

  • Behavior:
    • Removes initialization-time error for nested git repos in ShadowCheckpointService.ts.
    • Excludes nested repos from staging using pathspec excludes in stageAll().
    • Adds safety check to ensure no submodule changes are staged.
  • Detection:
    • findNestedRepos() detects nested repos from .gitmodules, git index, and filesystem.
    • Normalizes Windows-style paths to POSIX format.
  • Testing:
    • Updates tests in ShadowCheckpointService.spec.ts to verify nested repos are excluded.
    • Adds tests for handling .gitmodules, path normalization, and gitlink entries with spaces.

This description was created by Ellipsis for c98980d. You can customize this summary. It will automatically update as commits are pushed.

Instead of blocking checkpoints when nested git repos are detected,
now excludes them from staging to prevent submodule-related errors.

Changes:
- Removed initialization-time nested repo check that blocked feature
- Added findNestedRepos() to detect repos from multiple sources:
  * .gitmodules (declared submodules)
  * git index (gitlinks with mode 160000)
  * filesystem (.git directories and worktrees)
- Modified stageAll() to exclude nested repos using pathspec
- Added safety check to prevent submodule changes in staging
- Updated tests to verify nested repos are excluded from checkpoints

This allows checkpoints to work in monorepos and projects with
submodules while preventing git errors from nested repo changes.
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners October 27, 2025 17:13
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Oct 27, 2025
@roomote
Copy link

roomote bot commented Oct 27, 2025

Rooviewer Clock   See task on Roo Cloud

Reviewed commit c98980d. All previously flagged issues have been resolved.

  • Incomplete pathspec exclusion: Fixed by adding explicit gitlink removal before staging using git rm --cached --ignore-unmatch -r
  • Limited safety check coverage: Enhanced to use git ls-files -s --cached for comprehensive verification of mode 160000 entries, plus additional check for .gitmodules changes
  • Silent error handling: All git operations now log warnings when failures occur, improving debuggability
  • Redundant variable declaration in HEAD file processing: Fixed in commit 05fb2a3
  • Redundant variable declaration in worktree processing: Fixed in commit 05fb2a3
  • Path parsing fails for nested repos with spaces: Fixed in commit c98980d by using regex pattern to properly capture filenames with spaces
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 27, 2025
Copy link

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. Found 3 issues that should be addressed before approval. Please see the inline comments for details.

Improvements based on reviewer bot feedback:

1. Enhanced safety check (HIGH priority):
   - Now uses 'git ls-files -s --cached' to detect mode 160000 entries
   - Catches newly added/removed gitlinks, not just pointer changes
   - Added check for .gitmodules changes with warning log

2. Improved pathspec exclusion (MEDIUM priority):
   - Added 'git rm --cached' to remove existing gitlinks before staging
   - Prevents staging of gitlink entries already in the index
   - Ensures complete exclusion of nested repo changes

3. Better error logging (LOW priority):
   - Added warning logs for git command failures in findNestedRepos()
   - Helps debugging while avoiding feature breakage
   - Distinguishes expected errors (no .gitmodules) from real issues

All tests continue to pass with these enhancements.
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Oct 27, 2025
@hannesrudolph hannesrudolph added PR - Needs Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Oct 27, 2025
@roomote
Copy link

roomote bot commented Nov 2, 2025

See this task on Roo Code Cloud

Posted 2 inline review comments focusing on correctness across platforms and config resolution. Both are minor and straightforward to address.

  • Normalize nested repo pathspecs to POSIX when building excludes in TypeScript.stageAll() so Windows backslashes do not break git pathspec matching
  • Read .gitmodules via absolute path from workspaceDir in TypeScript.findNestedRepos() to ensure submodules are detected from the main workspace instead of shadow repo cwd

Mention @roomote in a comment to trigger your PR Fixer agent and make changes to this pull request.

@mrubens
Copy link
Collaborator

mrubens commented Nov 2, 2025

@daniel-lxs do you buy the Oroocle's comments?

@daniel-lxs daniel-lxs moved this from PR [Needs Review] to PR [Changes Requested] in Roo Code Roadmap Nov 6, 2025
@daniel-lxs
Copy link
Member Author

Moving back to Changes Requested

…gitmodules absolute path; add tests; verify no gitlinks staged and log .gitmodules changes
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PR - Changes Requested size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Status: PR [Changes Requested]

Development

Successfully merging this pull request may close these issues.

[BUG] Checkpoints feature is disabled because of nested git repos

4 participants